﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/User.Master" Inherits="System.Web.Mvc.ViewPage<SDT.Site.Areas.User.ViewModels.CompanyIndexViewModel>" %>
<%@ Import Namespace="SDT.Lib.Helpers" %>
<%@ Import Namespace="SDT.Lib.Paging" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Tin doanh nghiệp
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Header" runat="server">
	Tin doanh nghiệp
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="Message" runat="server">
    <%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%> 
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Toolbar" runat="server">
	<%= Html.Toolbar("Thêm mới", "/User/Company/Create/"  , "new") %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%if(ViewData["MessageInfo"]==null){ %>
<fieldset>
<legend>Danh sách tin đã đăng</legend>
	<form action="/User/Company" method="post" name="adminForm">
    <table width="100%">
        <tr>
            <td align="left">
                Tìm nhanh
                <%= Html.TextBox("Keyword", Model.Keyword) %>
                <%= Html.ActionImageJS("Tìm kiếm", "icon-32-search.png", "document.adminForm.submit();", false)%>
            </td>
        </tr>
    </table>
    <table width="100%" class="tblprice">
        <thead>
            <tr>
                <th width="10" align="right">
                    STT
                </th>
                <th style="width: 40px">
                    <%= Html.Sort("ID", "ID", ViewData["orderDir"].ToString(), ViewData["order"].ToString())%>
                </th>
                <th>
                    <%= Html.Sort("Tiêu đề", "Title", ViewData["orderDir"].ToString(), ViewData["order"].ToString())%>
                </th>
                <th style="width: 90px">
                    <%= Html.Sort("Ngày đăng", "AddDate", ViewData["orderDir"].ToString(), ViewData["order"].ToString())%>
                </th>
                <th style="width: 40px; color: #1D60FF;">
                    Sửa
                </th>
                <th style="width: 40px; color: #1D60FF;">
                    Xóa
                </th>
            </tr>
        </thead>
        <tbody>
            <% 
                int i = 0;
                foreach (var item in Model.Articles)
                {
                    i++;
            %>
            <tr>
                <td align="right">
                    <%= i.ToString() %>
                </td>
                <td align="center">
                    <%= Html.Encode(item.ID) %>
                </td>
                <td>
                    <a href="/company/Details/<%=item.ID %>/<%=Html.ToUrlFriendly(item.Title)%>"> <%=Html.Encode(item.Title) %></a>
                </td>
                <td>
                    <%= Html.Encode(string.Format("{0:dd/MM/yyyy}",item.AddDate))%>
                </td>
                <td> 
                    <%= Html.ActionImage("Sửa", "icon-24-edit.png", "User/company", "Edit", new Dictionary<string, object>() { { "id", item.ID } })%>
                </td>
                <td align="center">
                    <%= Html.ActionImage("Xóa", "icon-24-delete.png", "User/company", "Delete", new Dictionary<string, object>() { { "id", item.ID } })%>
                </td>
            </tr>
            <% } %>
        </tbody>
    </table>
    <%= Html.Hidden("order")%>
    <%= Html.Hidden("orderDir")%>
    <table width="100%">
        <tr>
            <td align="center">
                <div class="pager">
                    <label>
                        Hiển thị #</label>
                    <%
                        int[] pageSizeList = { 1, 5, 10, 15, 20, 25, 50, 100 };
                    %>
                    <%= Html.DropDownList("PageSize", new SelectList(pageSizeList, Model.Articles.PageSize), new { onchange = "document.adminForm.submit();" })%>
                    <%= Html.Pager(Model.Articles.PageSize, Model.Articles.PageNumber, Model.Articles.TotalItemCount)%>
                </div>
            </td>
        </tr>
    </table>
    </form>
    </fieldset>
<% } %>
</asp:Content>
